<?php
ob_start();
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
session_start();


require('functions.php');
$query = $_SERVER['QUERY_STRING'];



/* if(isset($_SESSION['applicant_id']))
  header('Location:index.php?dashboard'); */


if (isset($query) && $query != '') {
    $q = array_filter(explode('/', $query));
    if ($q[0] != 'login') {
        if ($q[0] != 'forgotpwd')
            if (!isset($_SESSION['applicant_id'])) {
                header('Location:index.php?login');
            }
    } else {
        if (isset($_SESSION['applicant_id']) && $_SESSION['applicant_id'] != '') {
            header('Location:index.php?dashboard');
        }
    }
} else {
    header('Location:index.php?login');
}

if ($q[0] == "logout") {
    session_destroy();
    header('Location:index.php?login');
}

if(isset($_SESSION['fb_user_id']) && $_SESSION['fb_user_id'] != 0)
	header('Location:../apply-now.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta name="viewport" content="width=device-width, initial-scale=1.0">

<script>
            (function(i, s, o, g, r, a, m) {
                i['GoogleAnalyticsObject'] = r;
                i[r] = i[r] || function() {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
                a = s.createElement(o),
                        m = s.getElementsByTagName(o)[0];
                a.async = 1;
                a.src = g;
                m.parentNode.insertBefore(a, m)
            })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

            ga('create', 'UA-42215372-1', 'morgancash.com.au');
            ga('send', 'pageview');

        </script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Same Day Payday Loans, Online Payday Loans, Payday Loans No Faxing - Max Cash</title>
<meta name="keywords" content="payday loans, online payday loans, personal loan, fast cash loans, cash loans, short term cash loans, bad credit loans, cash advance, no credit check loans, personal finance, instant cash loan, fast loans"/>
<meta name="description" content="Max Cash help solve financial hardship that you might have, we can provide fast cash loans to you, so you can be stress free."/>
<link rel="Shortcut Icon" href="images/favicon.png" type="images/png" />
<link rel="icon" href="images/favicon.png" type="images/png" />
<link rel="SHORTCUT ICON" href="../images/favicon.ico" />
<link rel="stylesheet" href="../assets/css/bootstrap.css" />
<link rel="stylesheet" href="../assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../assets/css/bootstrap-responsive.css" />
<link type="text/css" href="../assets/css/jquery-ui-1.10.0.custom.css" rel="stylesheet" />
<link rel="stylesheet" href="../assets/css/cost.css" />
<link rel="stylesheet" href="../assets/custom.css" />
<script src="../assets/js/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="../assets/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../assets/js/jquery-ui-1.10.0.custom.min.js" type="text/javascript"></script>
<script src="../assets/js/cost.js" type="text/javascript"></script>
<script src="uploadifive/jquery.uploadifive.min.js" type="text/javascript"></script>
<script src="../assets/js/jquery.blockUI.js" type="text/javascript"></script>
<script src="../assets/js/jquery.mask.min.js" type="text/javascript"></script>
<?php if($q[0] == 'requestmoney' || $q[0] == 'profile'): ?>
<script src="../assets/js/jquery.lat.validate.js" type="text/javascript"></script>
<script src="../assets/js/jquery.form.wizard.js" type="text/javascript"></script>
<script src="../assets/js/customfunctions_new.js" type="text/javascript"></script>	
<script type="text/javascript" src="assets/js/purl.js"></script>

<?php endif; ?>
<link rel="stylesheet" type="text/css" href="uploadifive/uploadifive.css">

<style>
#content{
	min-height:450px;
}
.navbar .nav > li { 
line-height: normal;
border-right: none;
border-left:none;
position: relative;
margin-left:0px;
}
.navbar .nav{
	color: #fff;
	margin-left:40px;
	margin-right:42px;
}
.navbar .nav > li > a {
float: none;
padding:9px;
color: inherit;
text-decoration: none;
text-shadow: none;
font-size: 13px;
font-weight: bold;
text-align: center; 
} 
 #declined{
	width:980px;
	margin:0 auto; 
	padding:10px; 
	font:bold 14px Arial, Helvetica, sans-serif; 
	background:#FFFFC6;
	border-right:2px solid #4B4B4B;
	border-left:2px solid #4B4B4B;
	border-bottom:2px solid #4B4B4B;
	-webkit-border-bottom-right-radius: 10px;
	-webkit-border-bottom-left-radius: 10px;
	-moz-border-radius-bottomright: 10px;
	-moz-border-radius-bottomleft: 10px;
	border-bottom-right-radius: 10px;
	border-bottom-left-radius: 10px;
	box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.3);
	line-height:140%;
	
}
</style>
<script type="text/javascript">
var rmoney = '<?php if($q[0] == 'requestmoney') echo 'requestmoney'; else echo 'null';?>';

            function MM_openBrWindow(theURL, winName, features) { //v2.0
                window.open(theURL, winName, features);
            }

            $(document).ready(function() {
                $('#upload').click(function() { 
                    $("#photo").click();
                });
            });
        </script>
</head>
<body>
<div class="bodyBgGradient"> 
  <div class="bodyBgImage">
    <div id="wrapper" class="container-fluid" >
      <div id="header">
      <!--<div id="declined">
  <p style="font-size:36px; padding:20px;" align="center" >Website under construction, please do not apply!</p>

</div>-->
                <div class="row-fluid">
          <div class="span4"><a href="http://www.maxcash.com.au/" id="logo"><img src="../graphics/logo.png"  alt="MaxCash" /></a></div>
          <div class="span3 offset5">
          <?php if (isset($_SESSION['applicant_id'])) { ?>
          <div id="loginInfo" class="text-right"><span>welcome <b><?php echo $_SESSION['display_name']; ?> | </b></span> <a href="index.php?logout">Logout</a><a href="../contact.html" class="btn btn-primary pull-right visible-desktop"><i class="fa fa-phone"> </i> Contact Us</a></div>
           <?php } ?>
         
        </div>
        </div>
        <div class="navbar">
          <div class="navbar-inner max-gradient">
            <div class="container"> 
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse"> 
            <span class="icon-bar"></span> <span class="icon-bar"></span> 
            <span class="icon-bar"></span> 
            </a>
              <div class="nav-collapse collapse navbar-responsive-collapse" style="background-color:#fff;"> 
              
              <div class="sidebar span3 visible-phone">
              <?php if ($row != NULL && $row['MC_apply'] == 0): ?>
              <ul class="nav nav-pills nav-stacked inactive-menu">
                <li class="last"><a href="">DASHBOARD</a></li>
                <li id="loanrequest" class="requestMoney"><a href="">REQUEST MONEY</a></li>
                <li id="currentloan"><a href="">CURRENT LOAN</a></li>
                <li class="last"><a href="">PROFILE</a></li>
                <li><a href="../contact.html"> CONTACT US</a></li>
              </ul>
              
                <?php else: ?>
              <ul class="nav nav-pills nav-stacked">
                <li class="last"><a href="index.php?dashboard">DASHBOARD</a></li>
              </ul>
              <ul class="nav nav-pills nav-stacked">
                <li id="loanrequest" class="requestMoney"><a href="index.php?requestmoney">REQUEST MONEY</a></li>
                </ul>
                <ul class="nav nav-pills nav-stacked">
                <li id="currentloan"><a href="">CURRENT LOAN</a></li>
              </ul>
              <ul class="nav nav-pills nav-stacked">
                <li class="last"><a href="index.php?profile">PROFILE</a></li>
              </ul>
              <ul class="nav nav-pills nav-stacked">
              <li><a href="../contact.html"> CONTACT US</a></li>
              </ul>
              <?php endif; ?>
            </div>      
            </div>
              
              <!-- /.nav-collapse -->
            </div>
          </div>
          <!-- /navbar-inner -->
        </div>
        </div>
        <div id="content">
          <div class="row-fluid">
            <?php if($q[0] == 'login'){
					include('login.php');
				}else{ 
				?>
            <div class="sidebar span3 visible-desktop ">
              <?php if ($row != NULL && $row['MC_apply'] == 0): ?>
              <ul class="nav nav-pills nav-stacked inactive-menu">
                <li class="last"><a href="">DASHBOARD</a></li>
                <li id="loanrequest" class="requestMoney"><a href="">REQUEST MONEY</a></li>
                <li id="currentloan"><a href="">CURRENT LOAN</a></li>
                <li class="last"><a href="">PROFILE</a></li>
              </ul>
              
                <?php else: ?>
              <ul class="nav nav-pills nav-stacked">
                <li class="last"><a href="index.php?dashboard">DASHBOARD</a></li>
              </ul>
              <ul class="nav nav-pills nav-stacked">
              
              
                <li id="loanrequest" class="requestMoney"><a href="index.php?requestmoney">REQUEST MONEY</a></li>
                <li id="currentloan"><a href="">CURRENT LOAN</a></li>
              </ul>
              <ul class="nav nav-pills nav-stacked">
                <li class="last"><a href="index.php?profile">PROFILE</a></li>
              </ul>
              
              <?php endif; ?>
            </div>
            <div id="mainContent" class="span8 contrast">
              <noscript>
              <div class="noscript">
                <h2> You must have JavaScript enabled to use our site.</h2>
                <p> Your browser has JavaScript disabled. To enable JavaScript please consult the help
                  menu of your browser.</p>
              </div>
              </noscript>
              <?php
                            if (isset($_SESSION['msg'])) {
                                echo '<div class="alert alert-error">' . $_SESSION['msg'] . '</div>';
                                unset($_SESSION['msg']);
                            }
                            ?>
			  			   <?php
                            if ($q[0] && file_exists($q[0] . '.php')) {
                                require($q[0] . '.php');
                            }
                            
                            }
							?>
            </div>
          </div>
      
        <div id="footer">
        <div class="row-fluid">
        <div class="span9"><ul class="nav nav-pills sub-links">
            <li><a href="../index.php">Home</a></li>
            <li><a href="../apply-now.php">Apply Now</a></li>
            <li><a href="../loans.html">Loans</a></li>
            <li><a href="../how-it-works.html">How it Works</a></li>
            <li><a href="../contact.html">Contact</a></li>
            <li><a href="../locations.html">Locations</a></li>
            <li><a href="../blog/index.php">Blog</a></li>
            <li><a href="../about-us.html">About Us</a></li>
            <li><a href="#">Google +</a></li>
          </ul></div>
        <div class="span3"><ul class="nav nav-pills header-lings" id="social-links">
            <li> <a href=""> <i class="fa fa-facebook-square fa-2x"></i></a></li>
            <li> <a href=""><i class="fa fa-twitter-square fa-2x"></i></a></li>
            <li> <a href=""><i class="fa fa-google-plus-square fa-2x"></i></a></li>
            <li> <a href=""><i class="fa fa-rss-square fa-2x"></i></a></li>
          </ul></div>
        </div>
          
          <p class="text-center">
            <button type="button" class="btn btn-white btn-large" data-toggle="modal" data-target="#warningModal"> <i class="fa fa-exclamation-triangle"></i> Warning about borrowing</button>
          </p>
          <p class="text-center"> <small>© 2013 Max Cash Limited. All rights reserved.</small> </p>
          <div class="modal fade" id="warningModal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display:none">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss=  "modal" aria-hidden="true">&times;</button>
                  <h4 class="modal-title" id"myModalLabel"> 
                  <i class="fa fa-exclamation-triangle"></i> WARNING - Do you really need a loan today?*</h4>
                </div>
                <div class="modal-body">
                  <div id="warningText"></div>
                  <script type="text/javascript"  src="../assets/js/warning.js"></script>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
              </div>
            </div>
          </div>
          <div id="warningText"></div>
           
        </div>
      </div>
    </div>
  </div>
  </div>
</body>
<script>
        $(document).ready(function() { 
								   
		<?php
		$loanResult = getLoanStatus($_SESSION['app_id']);	
		$status = strtolower($loanResult['status']);
		if($status!='close'){ ?>
		
		$('.requestMoney').addClass('disabled');
		$('.requestMoney a').click(function(event){
										  event.preventDefault(); 
		});
		
		<?php
		}
		
		?>

            $(document).on('click', '#cmail', function() {
                action = $(this).attr('action');

                if (action == 'OK')
                {
                    var email = $("[name='applicant_email_address']").val();
                    update_profile(email, 'email')
                }
                else
                {
                    $(this).attr({"src": "http://www.morgancash.com.au/draft/account/images/confirm.png", "action": "OK", "width": "16px", "height": "16px"});
                    $("[name='applicant_email_address']").removeAttr("readonly");
                }
            });

            $(document).on('click', '#cmobile', function() {
                action = $(this).attr('action');

                if (action == 'OK')
                {
                    var mobile = $("[name='applicant_mobile']").val();
                    update_profile(mobile, 'mobile')
                }
                else
                {
                    $(this).attr({"src": "http://www.morgancash.com.au/draft/account/images/confirm.png", "action": "OK", "width": "16px", "height": "16px"});
                    $("[name='applicant_mobile']").removeAttr("readonly");
                }
            });

            $(document).on('click', '#cphone', function() {
                action = $(this).attr('action');

                if (action == 'OK')
                {
                    var mobile = $("[name='applicant_phone']").val();
                    update_profile(mobile, 'mobile')
                }
                else
                {
                    $(this).attr({"src": "http://www.morgancash.com.au/draft/account/images/confirm.png", "action": "OK", "width": "16px", "height": "16px"});
                    $("[name='applicant_phone']").removeAttr("readonly");
                }
            });
            //"src" "http://www.morgancash.com.au/draft/account/images/confirm.png";
        });

        function update_profile(pro_data, ptype)
        {
            var request = $.ajax({
                url: "change.php",
                type: "POST",
                data: {pdata: pro_data, type: ptype},
                dataType: "html"
            });
            request.done(function(msg) {
                //$("#log").html( msg );
            });
            request.fail(function(jqXHR, textStatus) {
                //alert( "Request failed: " + textStatus );
            });
        }
 
        function verify_sms_code(pro_data)
        {
            var request = $.ajax({
                url: "verify.php?verify/sms/",
                type: "POST",
                data: {sms_vcode: pro_data},
                dataType: "html"
            });
            request.done(function(msg) {
                //$("#log").html( msg );
            });
            request.fail(function(jqXHR, textStatus) {
                //alert( "Request failed: " + textStatus );
            });
        }

        /*function verify_sms_code(pro_data, ptype)
         {	
     
     
         var request = $.get( "verify.php?verify/sms/"+<?php if (isset($_SESSION['applicant_id'])) echo $_SESSION['applicant_id']; ?>  );
         request.done(function( data ) {
         alert( "Data Loaded: " + data );
         });
         request.fail(function(jqXHR, textStatus) {
         //alert( "Request failed: " + textStatus );
         });	
     
     
         }
         */


    </script>
</html>
<?php
ob_flush();
//unset($_SESSION['msg']);
?>